import random
computer = random.randint(0, 2) #012
player = int(input('请出拳：0-拳头 1-剪刀 2-布 ：'))
#while player != 0 and player != 1 and player != 2:
#while player not in range(0,3):#0-2
print(computer)
while player not in [0,1,2]:
    player = int(input('0-拳头，1-布，2-剪刀，格式不对重新请出拳：'))
if (player == 0 and computer == 1) or (player == 1 and computer == 2) or (player == 2 and computer == 0):
    print('玩家获胜')
elif player == computer:
    print('平局')
else:
    print('电脑获胜')
